package com.wanxi.util;

import java.util.Random;

public class SkipSeven {
    public static void main(String[] args) {
        /**
         * 思路：
         * 1.第一个数最好从10以下喊起
         * 2.以后应该每个数加一
         * 3.找到数里面有七的数，continue
         * 4.要一直循环，则用死循环
         * 5.最大值为100；
         *
         */
        int startNum = 0;
        startNum = getStartNum();
        System.out.println("随机数为" + startNum);
        baoshu(startNum);
    }

    private static void baoshu(int startNum) {
        while (true) {
            startNum++;
            if (startNum > 100) {
                break;
            }
            if (startNum % 10 == 7 || startNum % 7 == 0 || startNum / 10 % 10 == 7) {
                System.out.println("过");
                continue;
            }
            System.out.println(startNum);

        }
    }

    /**
     * 随机数也不能为7
     *
     * @return
     */
    private static int getStartNum() {
        int num = new Random().nextInt(10);
        if (num == 7) {
//            getStartNum();
            num = new Random().nextInt(10) + 1;
        }
        return num;
    }
}
